package psn.qiuyiping.autocad.dxffile;

import java.util.Arrays;

public class DxfData<T> {
	int code;
	Object val;

	public DxfData(int code, T val) {
		this.code = code;
		this.val = val;
	}

	public int getCode() {
		return code;
	}

	@SuppressWarnings("unchecked")
    public T getVal() {
        return (T)val;
    }

 	public void setVal(Object val) {
		this.val = val;
	}

    @Override
    public String toString() {
        if(val.getClass().isArray()){
            return "DxfData [code=" + code + ", val=" + Arrays.toString((double[])val) + "]";
        }else{
            return "DxfData [code=" + code + ", val=" + val + "]";
        }
    }
	
}
